package com.csdn.chain;

import java.util.ArrayList;
import java.util.List;

public class Test {

    //链式调用
    public static void main(String[] args) {
        TestContext testContext = new TestContext();
        InvokeResult invokeResult = BlockHelper.flow(testContext, () -> {
            List<Plugin> pluginList = new ArrayList<>();
            pluginList.add(new AuthorPlugin());
            pluginList.add(new RequestPlugin());
            pluginList.add(new CallPlugin());
            pluginList.add(new ResponsePlugin());
            Plugin.PluginChain chain = new Plugin.PluginChain(0, testContext, pluginList);
            return chain.proceed();
        });
        System.out.println(invokeResult.getData());

        System.out.println(String.format("异常码【%s】,异常原因:%s",1000,"测试"));
    }


}
